package com.plian.system.wrapper.hr.recruitment;

import com.plian.system.dto.hr.recruitment.RecruitmentManagementDTO;
import com.plian.system.entity.hr.recruitment.RecruitmentManagement;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.hr.recruitment.RecruitmentManagementVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 招聘管理包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-11-15
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface RecruitmentManagementWrapper extends BaseWrapper<RecruitmentManagement, RecruitmentManagementDTO, RecruitmentManagementVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "companyNameId", target = "companyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "companyNameId", target = "companyCode", qualifiedByName = ORG_ID_TO_CODE),
			@Mapping(source = "planAttributeId", target = "planAttributeName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "recruitmentAttributeId", target = "recruitmentAttributeName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "recruitmentMethodsId", target = "recruitmentMethodsName" , qualifiedByName = DICT_CODE_TO_NAME)
	})
	RecruitmentManagementVO entityToVO(RecruitmentManagement entity);

}
